<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%
    request.setCharacterEncoding("UTF-8");
    String htmlData = request.getParameter("content1") != null ? request.getParameter("content1") : "";
%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
    String date = format.format(new Date());
%>
<%@ include file="/WEB-INF/JSP/backHome/modalWindows/StudentsListExamOderPage.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <script type="text/javascript" src="<%=path%>/My97DatePicker/WdatePicker.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=path%>/CSS/bombBox.css">
    <link rel="stylesheet" type="text/css" href="<%=path%>/CSS/backLayout.css">
</head>
<style>
    select {
        width: 234px;
        height: 31px
    }

    .gn_name {
        padding-top: 5px
    }

    .div_zilei {
        width: 600px;
        padding-left: 90px;
        height: 30px
    }

    .tr td {
        font-size: 14px;
        color: #ffffff
    }

    .tr_td {
        height: 40px;
    }

    .tr_td td {
        border-bottom: 1px solid #ededed;
        text-align: center;
    }

    tr td:nth-child(1) {
        color: black;
        font-size: 16px
    }

    td {
        border: 1px solid #000
    }
</style>
<body style="background: #f5f5f5">
<div class="main">
    <div class="weizhi">
        预约管理>>考试预约(批量)>>新增
    </div>

    <div class="div_body">


        <div class="div_form" style="min-height: 1000px">
            <!--新增  -->
            <form action="<%=path%>/DrivingSys/outXls" class="form" method="post">

                <div class="div_input_hang">
                    <div class="input_hang">
                        <span class="gn_name">加油卡&nbsp;:&nbsp;</span>
                        <input name="cfexamdate" id="date" readonly="readonly" value="${fname}" style="color: gray;"/>
                    </div>
                    <div class="input_hang">
                        <span class="gn_name">开始时间&nbsp;:&nbsp;</span>
                        <input class="yyCount" disabled="disabled" type="text" value="${beginTime}"
                               style="color: gray;"/>

                    </div>
                    <div class="input_hang">
                        <span class="gn_name">结束时间&nbsp;:&nbsp;</span>
                        <input class="ckCount" disabled="disabled" value="${endTime}" type="text" style="color: gray;"/>
                    </div>
                </div>

                <div class="success">
                    <div style="min-height: 240px;width: 85%;padding-left: 20px;padding-top: 20px;">
                        <table width="100%" align="center" style="min-height:30px;border-spacing:0;">
                            <tr>
                                <td style="width: 5px;height: 50px;background: rgb(169,155,224);"></td>
                                <td style="width: 27px;height: 50px;background: rgb(169,155,224);" align="center">业务类型
                                </td>
                                <td style="width: 22px;height: 50px;background: rgb(169,155,224);" align="center">车辆
                                </td>
                                <td style="width: 23px;height: 50px;background: rgb(169,155,224);" align="center">金额
                                </td>
                                <td style="width: 24px;height: 50px;background: rgb(169,155,224);" align="center">
                                    数量（公升）
                                </td>
                                <td style="width: 25px;height: 50px;background: rgb(169,155,224);" align="center">业务日期
                                </td>
                                <td style="width: 30px;background: rgb(169,155,224);" align="center">备注</td>
                            </tr>
                            <tr>
                                <td width="20px" rowspan="2"></td>
                                <td style="width: 20px;" rowspan="2" align="center">期初</td>
                                <td style="width: 20px;" align="center"></td>
                                <td style="width: 20px;" align="center">${beginBalance}</td>
                                <td style="width: 20px;" align="center">0</td>
                                <td style="width: 20px;" align="center">${beginTime}</td>
                                <td style="width: 20px;" align="center"></td>
                            </tr>

                            <tr>
                                <td style="width: 20px;background: rgb(76,219,136);" align="center">小计</td>
                                <td style="width: 20px;background: rgb(76,219,136);" align="center">${beginBalance}</td>
                                <td style="width: 20px;background: rgb(76,219,136);" align="center">0</td>
                                <td style="width: 20px;background: rgb(76,219,136);" align="center"></td>
                                <td style="width: 20px;background: rgb(76,219,136);" align="center"></td>
                            </tr>
                            <tr>
                                <td style="width: 10px;background: rgb(255,255,216);"></td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center">小计</td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center"></td>
                                <td style="width: 20px;background: rgb(255,255,216);"
                                    align="center">${beginBalance}</td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center">0</td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center"></td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center"></td>
                            </tr>
                            <tbody id="table1" style="border-spacing: 0px">
                            <c:forEach items="${fillingCardRecharges}" var="fillingCardRecharge">
                                <tr style="border-left: 1px solid #c7c7c7;">
                                    <td width="20px"></td>
                                    <td style="width: 20px;" align="center">充值</td>
                                    <td style="width: 20px;" align="center">充值</td>
                                    <td style="width: 20px;" align="center">${fillingCardRecharge.cfamount}</td>
                                    <td style="width: 20px;" align="center">0</td>
                                    <td style="width: 20px;" align="center">${fillingCardRecharge.fbizdate}</td>
                                    <td style="width: 20px;" align="center">${fillingCardRecharge.fdescription}</td>
                                </tr>
                            </c:forEach>
                            </tbody>
                            <tr>
                                <td style="width: 5px;background: rgb(255,255,216);" width="20px"></td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center">小计</td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center"></td>
                                <td class="fillingBeginBalance" style="width: 20px;background: rgb(255,255,216);"
                                    align="center">${fillingBeginBalances}</td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center">0</td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center"></td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center"></td>
                            </tr>

                            <tbody id="table2">
                            <c:forEach items="${cardRegEntries}" var="cardRegEntrie">
                                <tr>
                                    <td width="20px"></td>
                                    <td style="width: 20px;" align="center">车辆加油</td>
                                    <td style="width: 20px;" align="center">${cardRegEntrie.cfcarName}</td>
                                    <td style="width: 20px;" align="center">-${cardRegEntrie.cfamount}</td>
                                    <td style="width: 20px;" align="center">${cardRegEntrie.cfqty}</td>
                                    <td style="width: 20px;" align="center">${cardRegEntrie.fbizdate}</td>
                                    <td style="width: 20px;" align="center">${cardRegEntrie.cfdesc}</td>
                                </tr>
                            </c:forEach>
                            </tbody>
                            <tfoot></tfoot>
                            <tbody id="table3" style="border-spacing: 0px">
                            <tr>
                                <td style="width: 5px;background: rgb(255,255,216);"></td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center">小计</td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center"></td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center">
                                    -${reflueBeginBalances}</td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center">${cfamout}</td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center"></td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center"></td>
                            </tr>
                            <tr>
                                <td width="20px" rowspan="2"></td>
                                <td style="width: 20px;" rowspan="2" align="center">期末</td>
                                <td style="width: 20px;" align="center"></td>
                                <td style="width: 20px;" align="center">${endBalance}</td>
                                <td style="width: 20px;" align="center"></td>
                                <td style="width: 20px;" align="center">${endTime}</td>
                                <td style="width: 20px;" align="center"></td>
                            </tr>
                            <tr>
                                <td style="width: 20px;background: rgb(76,219,136);" align="center">小计</td>
                                <td style="width: 20px;background: rgb(76,219,136);" align="center">${endBalance}</td>
                                <td style="width: 20px;background: rgb(76,219,136);" align="center"></td>
                                <td style="width: 20px;background: rgb(76,219,136);" align="center"></td>
                                <td style="width: 20px;background: rgb(76,219,136);" align="center"></td>
                            </tr>
                            <tr>
                                <td style="width: 5px;background: rgb(255,255,216);"></td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center">小计</td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center"></td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center">${endBalance}</td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center"></td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center"></td>
                                <td style="width: 20px;background: rgb(255,255,216);" align="center"></td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="div_tj" style="padding-top: 0px;height: 60px">
                    <div>
                        <input class="input_submit" value="导出EXCLE" type="submit">
                    </div>
                    <div>
                        <input type="button" class="input_back" value="关   闭"/>
                    </div>
                </div>
                <input id="xls" type="hidden" name="xls" value="">
                <input type="hidden" name="fileNames" value="加油卡统计报表">
            </form>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" src="<%=path%>/JQuery/jquery-1.8.2.js"></script>
<script type="text/javascript">


    $(document).ready(function () {


        _w_table_rowspan("#table2", "3", '1')


        _w_table_rowspan("#table2", "2", '0')


        _w_table_rowspan2("#table1", "3", '0')


        _w_table_rowspan2("#table1", "2", '1')


        function _w_table_rowspan(_w_table_id, _w_table_colnum, flag) {

            flag = flag
            length = $(_w_table_id).find('tr').length
            _w_table_firsttd = "";
            _w_table_currenttd = "";
            _w_table_SpanNum = 0;
            _w_table_totalCount = 0;    //小计数量
            _w_table_totalPrice = 0;	//小计价格
            _w_table_Obj = $(_w_table_id + " tr td:nth-child(" + _w_table_colnum + ")");
            _w_table_Obj.each(function (i) {
                if (i == 0) {
                    _w_table_firsttd = $(this);
                    _w_table_SpanNum = 1;
                    _w_table_totalPrice = _w_table_firsttd.next().text() - 0;
                    _w_table_totalCount = _w_table_firsttd.next().next().text() - 0;

                } else {
                    _w_table_currenttd = $(this);
                    if (_w_table_SpanNum == 1) {
                        _w_table_totalPrice = _w_table_firsttd.next().text() - 0;
                        _w_table_totalCount = _w_table_firsttd.next().next().text() - 0;
                    }
                    if (_w_table_firsttd.text() == _w_table_currenttd.text()) {
                        _w_table_SpanNum++;
                        if (flag == 1) {
                            _w_table_totalPrice = _w_table_totalPrice + (_w_table_currenttd.next().text() - 0)
                            _w_table_totalCount = _w_table_totalCount + (_w_table_currenttd.next().next().text() - 0)
                            /* alert(_w_table_totalPrice) */
                            if (i == length - 1) {          //最后一个
                                str = '<tr><td style="width: 20px;" align="center"></td>'
                                str += '<td style="width: 20px;background: rgb(76,219,136);" align="center">车辆加油</td> <td style="width: 20px;background: rgb(76,219,136);" align="center">小计'
                                str += '</td> <td style="width: 20px;background: rgb(76,219,136);" align="center">' + _w_table_totalPrice + '</td><td style="width: 20px;background: rgb(76,219,136);" align="center">' + _w_table_totalCount + '</td>'
                                str += '<td style="width: 20px;background: rgb(76,219,136);" align="center"> '
                                str += '</td><td style="width: 20px;background: rgb(76,219,136);" align="center"></td> </tr>'
                                _w_table_firsttd.attr("rowSpan", _w_table_SpanNum - 0 + 1);
                                $(_w_table_id).append(str)
                            }

                        }

                        _w_table_currenttd.remove();    //remove();
                        _w_table_firsttd.attr("rowSpan", _w_table_SpanNum);
                    }
                    else {
                        _w_table_totalCount = _w_table_totalCount.toFixed(2)
                        _w_table_totalPrice = _w_table_totalPrice.toFixed(2)
                        str = '<tr><td style="width: 20px;" align="center"></td>'
                        str += '<td style="width: 20px;background: rgb(76,219,136);" align="center">车辆加油</td> <td style="width: 20px;background: rgb(76,219,136);" align="center">小计'
                        str += '</td> <td style="width: 20px;background: rgb(76,219,136);" align="center">' + _w_table_totalPrice + '</td><td style="width: 20px;background: rgb(76,219,136);" align="center">' + _w_table_totalCount + '</td>'
                        str += '<td style="width: 20px;background: rgb(76,219,136);" align="center"> '
                        str += '</td><td style="width: 20px;background: rgb(76,219,136);" align="center"></td> </tr>'
                        _w_table_currenttd.parent().prev().after(str)
                        _w_table_totalCount = 0;
                        _w_table_totalPrice = 0
                        _w_table_firsttd = $(this);
                        _w_table_SpanNum = 1;
                    }
                }


            });

        }


        function _w_table_rowspan2(_w_table_id, _w_table_colnum, flag) {
            var fillingBeginBalance = $('.fillingBeginBalance').html()
            var str = '<tr><td style="width: 20px;" align="center"></td>'
            str += '<td style="width: 20px;background: rgb(76,219,136);" align="center">小计</td> <td style="width: 20px;background: rgb(76,219,136);" align="center">'
            str += '' + fillingBeginBalance + '</td> <td style="width: 20px;background: rgb(76,219,136);" align="center">0</td><td style="width: 20px;background: rgb(76,219,136);" align="center"></td> <td style="width: 20px;background: rgb(76,219,136);" align="center"> '
            str += '</td></tr>'
            _w_table_firsttd = "";
            _w_table_currenttd = "";
            _w_table_SpanNum = 0;
            _w_table_Obj = $(_w_table_id + " tr td:nth-child(" + _w_table_colnum + ")");
            _w_table_Obj.each(function (i) {
                if (i == 0) {
                    _w_table_firsttd = $(this);
                    _w_table_SpanNum = 1;
                } else {
                    _w_table_currenttd = $(this);
                    if (_w_table_firsttd.text() == _w_table_currenttd.text()) {
                        _w_table_SpanNum++;
                        _w_table_currenttd.remove(); //remove();
                        _w_table_firsttd.attr("rowSpan", _w_table_SpanNum);
                    } else {
                        _w_table_firsttd = $(this);
                        _w_table_SpanNum = 1;

                    }
                }

            });
            if (flag == 1) {
                _w_table_firsttd.attr("rowSpan", _w_table_SpanNum - 0 + 1);
                $(_w_table_id).append(str)

            }

        }


        $('.state').val($('.cfbilltype').val() - 0 - 1)

        $('#xls').val($('.form').html());


        var User = function () {

            this.init = function () {
                $("#uploadEventBtn").live("click", function () {
                    $("#uploadEventFile").click();
                });

                $("#uploadEventFile").live("change", function () {
                    $("#uploadEventPath").attr("value", $("#uploadEventFile").val());
                    var uploadEventFile = $("#uploadEventFile").val();
                    if (confirm("是否把数据导入到考试预约")) {//弹出确认对话框
                        if (uploadEventFile.lastIndexOf(".xls") < 0) {//可判断以.xls和.xlsx结尾的excel
                            alert("只能上传Excel文件");
                            return false;
                        } else {

                            var url = '<%=path%>/DrivingSys/uploadExamOrderMass';
                            var formData = new FormData($('form')[1]);
                            //alert(formData)
                            user.sendAjaxRequest(url, 'POST', formData);
                        }
                        return true;    //点击确定时，返回值为true，执行如上操作。
                    } else {
                        return false; //点击取消时，返回值为false，不执行操作。
                    }

                });

            }
            this.sendAjaxRequest = function (url, type, data) {
                $.ajax({
                    url: url,
                    type: type,
                    data: data,
                    success: function (json) {
                        var str = ''
                        for (var i = 0; i < json.length; i++) {
                            str += "<tr align='left' class='tr_td'><td style='width:20px' ></td>";
                            str += "<td><input type='text' name='cfstudentname' readonly='readonly' style='width:200px'  value=" + json[i].fnameL2 + "><input type='hidden' name='cfstudentid' value=" + json[i].fid + " ></td>"
                            str += "<td><input type='text'  readonly='readonly' style='width:200px' value=" + json[i].fnumber + "  ></td>"
                            if (json[i].cfsex == 1) {
                                str += "<td><input type='text' readonly='readonly' style='width:200px' value='男'   ></td>"
                                str += "<input type='hidden' name='cfsex1' value=" + json[i].cfsex + " >"
                            } else if (json[i].cfsex == 2) {
                                str += "<td><input type='text' readonly='readonly' style='width:200px' value='女' ></td>"
                                str += "<input type='hidden' name='cfsex1' value=" + json[i].cfsex + " >"
                            } else {
                                str += "<td><input type='text'readonly='readonly' style='width:200px' value='' ></td>"
                                str += "<input type='hidden' name='cfsex1' value=" + json[i].cfsex + " >"
                            }
                            str += "<td><input type='text' readonly='readonly' style='width:200px' value=" + json[i].cfclazzName + " name='cfclazz' >"
                            str += "<input type='hidden'readonly='readonly' name='cfclazzid' value=" + json[i].cfclazzid + " ></td>"
                            if (json[i].cfslzjcxdh[0] == 'A' || json[i].cfslzjcxdh[0] == 'B') {
                                str += "<td><input type='text' readonly='readonly' style='width:200px' value=" + json[i].cfslzjcxdh + "  ></td>"
                                str += "<input type='hidden' readonly='readonly' name='cfcarbyte' value='2' ></td>"
                            } else {
                                str += "<td><input type='text' readonly='readonly' style='width:200px' value=" + json[i].cfslzjcxdh + "  ></td>"
                                str += "<input type='hidden' readonly='readonly' name='cfcarbyte' value='1' ></td>"
                            }
                            str += "<td><input type='text' readonly='readonly' style='width:200px' value=" + json[i].cfidcardno + " name='cfidcardno' ></td>"
                            str += "<td><input type='text' readonly='readonly' style='width:200px' value=" + json[i].cfsjhm + " name='cfmobile' ></td>"
                            str += "<td><input type='text' readonly='readonly' style='width:200px' value=" + json[i].cfamount + " name='cfamount' ></td>"
                            str += "<td><input type='text' readonly='readonly' style='width:200px' value=" + json[i].cfreceived + " name='cfreceived' ></td>"
                            str += "<td><input type='text' readonly='readonly' style='width:200px' value=" + json[i].cffavorable + " name='cffavorable' ></td>"
                            str += "<td><input type='text' readonly='readonly' style='width:200px' value=" + json[i].cfarrearage + " name='cfarrearage' ></td>"
                            if (json[i].cfckbk == 1) {
                                str += "<td><input type='text' readonly='readonly' style='width:200px' value='初考'   ></td>"
                                str += "<input type='hidden' name='cfckbk' value=" + json[i].cfckbk + " >"
                                $('.ckCount').val($('.ckCount').val() - 0 + 1)
                            } else if (json[i].cfckbk == 2) {
                                str += "<td><input type='text' readonly='readonly' style='width:200px' value='补考' ></td>"
                                str += "<input type='hidden' readonly='readonly' name='cfckbk' value=" + json[i].cfckbk + " >"
                                $('.bkCount').val($('.bkCount').val() - 0 + 1)
                            } else {
                                str += "<td><input type='text' readonly='readonly' style='width:200px' value='初考' ></td>"
                                str += "<input type='hidden' name='cfckbk' value='1' >"
                                $('.ckCount').val($('.ckCount').val() - 0 + 1)
                            }
                            if (json[i].cfremark == null) {
                                str += "<td><input type='text' readonly='readonly' style='width:200px' value='' name='cfremark' ></td> </tr>"
                            } else {
                                str += "<td><input type='text' readonly='readonly' style='width:200px' value=" + json[i].cfremark + " name='cfremark' ></td> </tr>"
                            }
                            if ($('.flag').val() == 1) {
                                str += "<input type='hidden' name='cfsubscriberesult1' value='1' >"
                            } else {
                                str += "<input type='hidden' name='cfsubscriberesult1' value='2' >"
                                /* $('.fail').find(".table1 td").css('background','#ff7267') */
                            }
                        }

                        if ($('.flag').val() == 1) {
                            $('.success').find(".table1").append(str)
                            if ($('.yyCount').val() == null || $('.yyCount').val() == '') {
                                $('.yyCount').val(json.length)
                            } else {
                                $('.yyCount').val((json.length) + ($('.yyCount').val() - 0))
                            }
                        } else {
                            $('.fail').find(".table1").append(str)
                            /* $('.fail').find(".table1 td").css('background','#ff7267') */
                        }

                        /* if(result == null){
                         alert("没有可以导入的数据！")
                         }else{
                         var str="";
                         for (var i = 0; i <result["failed"].length; i++) {
                         str+="姓名:"+result["failed"][i]["name"]+"    失败原因:"+result["failed"][i]["mes"]+"\n\n";
                         }
                         alert("总共有"+result["failed"][0]["sumcount"]+"条数据，"+
                         "其中失败"+result["failed"].length+"条\n\n"+str);
                         } */
                        $('.flags').val(json.length)
                    },
                    error: function () {
                        alert("excel上传失败");
                    },
                    cache: false,
                    contentType: false,
                    processData: false
                });
            };


        }

        var user;
        $(function () {
            user = new User();
            user.init();
        });
    })


    $('#exportExcle').live('click', function () {
        location.href = '<%=path%>/DrivingSys/exportExamOrderMassExcle'
    })

    $('.input_back').click(function () {
        location.href = '<%=path%>/DrivingSys/chooseFuelCardJournal'
    })


    /*
     $(".addTable").click(function(){

     }) */


    $('.subtn').click(function () {
        var spCodesTemp = "";
        $('input:checkbox[name=student]:checked').each(function (i) {
            if (0 == i) {
                spCodesTemp = $(this).val();
            } else {
                spCodesTemp += ("," + $(this).val());
            }
        });
        var tr_len = $("#table1 tr").length;//表格长
        $.ajax({
            url: '<%=path%>/DrivingSys/selStudentByFid',
            type: "post",
            data: {'id': spCodesTemp},
            dataType: "json",
            success: function (json) {
                var json = json.studentsNameList
                var str = ''
                for (var i = 0; i < json.length; i++) {
                    str += "<tr align='left' class='tr_td'><td style='width:20px' ></td>";
                    str += "<td><input type='text' name='cfstudentname' readonly='readonly' style='width:200px'  value=" + json[i].fnameL2 + "><input type='hidden' name='cfstudentid' value=" + json[i].fid + " ></td>"
                    str += "<td><input type='text'  readonly='readonly' style='width:200px' value=" + json[i].fnumber + "  ></td>"
                    if (json[i].cfsex == 1) {
                        str += "<td><input type='text' readonly='readonly' style='width:200px' value='男'   ></td>"
                        str += "<input type='hidden' name='cfsex1' value=" + json[i].cfsex + " >"
                    } else if (json[i].cfsex == 2) {
                        str += "<td><input type='text' readonly='readonly' style='width:200px' value='女' ></td>"
                        str += "<input type='hidden' name='cfsex1' value=" + json[i].cfsex + " >"
                    } else {
                        str += "<td><input type='text'readonly='readonly' style='width:200px' value='' ></td>"
                        str += "<input type='hidden' name='cfsex1' value=" + json[i].cfsex + " >"
                    }
                    str += "<td><input type='text' readonly='readonly' style='width:200px' value=" + json[i].cfclazzName + " name='cfclazz' >"
                    str += "<input type='hidden'readonly='readonly' name='cfclazzid' value=" + json[i].cfclazzid + " ></td>"
                    if (json[i].cfslzjcxdh[0] == 'A' || json[i].cfslzjcxdh[0] == 'B') {
                        str += "<td><input type='text' readonly='readonly' style='width:200px' value=" + json[i].cfslzjcxdh + "  ></td>"
                        str += "<input type='hidden' readonly='readonly' name='cfcarbyte' value='2' ></td>"
                    } else {
                        str += "<td><input type='text' readonly='readonly' style='width:200px' value=" + json[i].cfslzjcxdh + "  ></td>"
                        str += "<input type='hidden' readonly='readonly' name='cfcarbyte' value='1' ></td>"
                    }
                    str += "<td><input type='text' readonly='readonly' style='width:200px' value=" + json[i].cfidcardno + " name='cfidcardno' ></td>"
                    str += "<td><input type='text' readonly='readonly' style='width:200px' value=" + json[i].cfsjhm + " name='cfmobile' ></td>"
                    str += "<td><input type='text' readonly='readonly' style='width:200px' value=" + json[i].cfamount + " name='cfamount' ></td>"
                    str += "<td><input type='text' readonly='readonly' style='width:200px' value=" + json[i].cfreceived + " name='cfreceived' ></td>"
                    str += "<td><input type='text' readonly='readonly' style='width:200px' value=" + json[i].cffavorable + " name='cffavorable' ></td>"
                    str += "<td><input type='text' readonly='readonly' style='width:200px' value=" + json[i].cfarrearage + " name='cfarrearage' ></td>"
                    if (json[i].cfckbk == 1) {
                        str += "<td><input type='text' readonly='readonly' style='width:200px' value='初考'   ></td>"
                        str += "<input type='hidden' name='cfckbk' value=" + json[i].cfckbk + " >"
                        $('.ckCount').val($('.ckCount').val() - 0 + 1)
                    } else if (json[i].cfckbk == 2) {
                        str += "<td><input type='text' readonly='readonly' style='width:200px' value='补考' ></td>"
                        str += "<input type='hidden' readonly='readonly' name='cfckbk' value=" + json[i].cfckbk + " >"
                        $('.bkCount').val($('.bkCount').val() - 0 + 1)
                    } else {
                        str += "<td><input type='text' readonly='readonly' style='width:200px' value='初考' ></td>"
                        str += "<input type='hidden' name='cfckbk' value='1' >"
                        $('.ckCount').val($('.ckCount').val() - 0 + 1)
                    }
                    if (json[i].cfremark == null) {
                        str += "<td><input type='text' readonly='readonly' style='width:200px' value='' name='cfremark' ></td> </tr>"
                    } else {
                        str += "<td><input type='text' readonly='readonly' style='width:200px' value=" + json[i].cfremark + " name='cfremark' ></td> </tr>"
                    }
                    if ($('.flag').val() == 1) {
                        str += "<input type='hidden' name='cfsubscriberesult1' value='1' >"
                    } else {
                        str += "<input type='hidden' name='cfsubscriberesult1' value='2' >"
                        /* $('.fail').find(".table1 td").css('background','#ff7267') */
                    }
                }

                if ($('.flag').val() == 1) {
                    $('.success').find(".table1").append(str)
                    if ($('.yyCount').val() == null || $('.yyCount').val() == '') {
                        $('.yyCount').val(json.length)
                    } else {
                        $('.yyCount').val((json.length) + ($('.yyCount').val() - 0))
                    }
                } else {
                    $('.fail').find(".table1").append(str)
                    /* $('.fail').find(".table1 td").css('background','#ff7267') */
                }
                $('.flags').val(json.length)
                $('#modal-overlay').css('visibility', 'hidden')
                $('.modal-data').css('visibility', 'hidden')
            },
            error: function () {
                alert('Error');
            }
        });
    })


</script>
</html>